/**
 * @file microwave_module.c
 * @author Rocky
 * @brief 微波模块驱动程序
 * @version 0.1
 * @date 2024-03-26
 * 
 * @copyright Copyright (c) 2024
 * 
 */

#include "spidev_interface.h"
#include "gpio_ctrl.h"

#define PROGRAM_NAME "microwave_interface"

/* 模块电源 高电平开启、
   复位 低电平有效
   接收开启 高电平有效 */
#define WAV_PWR_PORT "gpiochip6"
#define WAV_PWR_PIN  15
#define WAV_RST_PORT "gpiochip9"
#define WAV_RST_PIN  6
#define WAV_DIS_PORT "gpiochip9"
#define WAV_DIS_PIN  7
#define ENABLE       1
#define DISABLE      0

static int microwave_spi_fd;
static uint32_t microwave_spi_mode = 0;
static int8_t microwave_spi_bits = 8;
static uint32_t microwave_spi_speed = 500000;

/**
 * @brief 微波模块初始化
 * 
 * @return int 
 */
int microwave_module_init()
{
    return 0;
}

int close_microwave_module()
{
    int ret;
    ret = 0;
    return ret;
}

/**
 * @brief 设置微波发送模块的频率码和衰减
 * 
 * @param MHz 频率，范围800MHz~2000MHz
 * @param attenuation 衰减控制，0-30dB
 * @return int 
 */
void set_microwave_tx_frequency(uint16_t MHz, uint8_t attenuation)
{

}


/**
 * @brief 设置微波接收模块的频率码和衰减
 * 
 * @param MHz 频率，范围800MHz~2000MHz
 * @param attenuation 衰减控制，0-30dB
 * @return int 
 */
void set_microwave_rx_frequency(uint16_t MHz, uint8_t attenuation)
{

}
